import { handleActions } from 'redux-actions'
import { STORE_USER, STORE_CITY, STORE_CORP, STORE_PARTNER, STORE_CARDATA } from '../types/main'

export default handleActions({
  [STORE_USER](state, action) {
    return {
      ...state,
      user: action.payload
    }
  },
  [STORE_CITY](state, action) {
    return {
      ...state,
      city: action.payload
    }
  },
  [STORE_CORP](state, action) {
    return {
      ...state,
      corp: action.payload
    }
  },
  [STORE_PARTNER](state, action) {
    return {
      ...state,
      minaPartner: action.payload
    }
  },
  [STORE_CARDATA](state, action) {
    return {
      ...state,
      carData: action.payload
    }
  }
}, {
  user: undefined,
  city: undefined,
  corp: undefined,
  minaPartner: undefined,
  carData: undefined
})
